localstorage
			
function test(){		
	var flag_email=0;
	var flag_name=0;
	var flag_phone=0;
	var flag_password=0;
	var flag_password_2=0;
	function checkEmail(){   //检验邮箱是否符合规定
		var m=document.getElementById("email");
		var mail=m.value;
		var reg =/^\w+@[a-zA-Z0-9]+\.[a-z]+$/i;
		if(mail.length<6 || mail.length>18 || !reg.test(mail))
		{
			document.getElementById("email").innerHTML="请重新输入有效邮箱!";
			document.getElementById("email").style.color="red";
			flag_email=0;
		}
		else{
			document.getElementById("email").style.color="green";
			flag_email=1;
		}
	}
	  
	function checkName(){   //检测用户名
		var s=document.getElementById("username");
		var str=s.value;
		var reg=/^[a-zA-Z0-9\u4E00-\u9FA5]+$/;
		if(str.length>=2 && str.length<=12 && reg.test(str)){
			document.getElementById("username").style.color="green";
			flag_name=1;
		}
		else{
			document.getElementById("username").innerHTML="请输入2-12位以内的中英文和数字!";
			document.getElementById("username").style.color="red";
			flag_name=0;
		}   
		var tem=document.getElementById("username").value;
				var b=localStorage.getItem(tem);
				if(b!=null){
					alert("提示\n\n邮箱已被使用");
					flag_name=0;//重复	
	}
	function checkPhone(){   //检验手机号是否符合规定
		var p=document.getElementById("phoneNumber");
		var phone=p.value;
		var reg_1=/^[0-9]+$/;
		if(phone.length==11 && reg_1.test(phone)){
			document.getElementById("phoneNumber").style.color="green";
			flag_phone=1;
		}
		else{
			document.getElementById("phoneNumber").innerText="请重新输入!";
			document.getElementById("phoneNumber").style.color="red";
			flag_phone=0;
		}
	}
	function checkPassword(){  //验证密码是否符合规定
		var s=document.getElementById("password");
		var str=s.value;
		if(str.length<4 || str.length>12){
			document.getElementById("password").innerHTML="Error!请重新输入!";
			document.getElementById("password").style.color="red";
			flag_password=0;
		}
		else{
			document.getElementById("password").style.color="green";
			flag_password=1;
		}
	}
	function checkPassword_2(){  //验证确认密码是否和密码相同
		var p1=document.getElementById("password").value;
		var p2=document.getElementById("password_2").value;
		if(p1!=p2){
			document.getElementById("password_2").innerHTML="Error!两次输入密码不一致!";
			document.getElementById("password_2").style.color="red";
			flag_password_2=0;
		}
		else{
			document.getElementById("password_2").style.color="green";
			flag_password_2=1;
		}
	}
	function submitbox(){   //注册
		if(flag_email==1 && flag_name==1 && flag_phone==1 && flag_password==1 && flag_password_2==1){
			window.open("login.html");// window.location.href ='successx.html';
		}
		else
			alert("注册失败！");
	}
	}	